package cn.com.dhcc.app.pub.module.logmgr.vo;

import java.util.Date;

import cn.com.dhcc.app.core.annotation.WsdColumn;
import cn.com.dhcc.app.core.annotation.WsdNotDbColumn;
import cn.com.dhcc.app.core.annotation.WsdTable;
import cn.com.dhcc.app.core.base.ModuleFeatureBean;
import cn.com.dhcc.app.core.component.log.Logger;


/**
 * 日志对象
 * @author qiao
 * @2015-6-5 @下午3:52:15
 */
@WsdTable
public class LogBean extends ModuleFeatureBean{

	public LogBean() {
		super();
	}
	public LogBean(String userType, String userId, String userName,
			String requestIp,String logType, String module, String action, String result,
			String level, String line, String msg,String throwMsg, Date logTime
			) {
		super();
		this.userType = userType;
		this.userId = userId;
		this.userName = userName;
		this.requestIp = requestIp;
		this.logType = logType;
		this.module = module;
		this.action = action;
		this.result = result;
		this.level = level;
		this.line = line;
		this.msg = msg;
		this.logTime = logTime;
		this.throwMsg = throwMsg;
	}


	@Override
	public String tableName() {
		return Logger.getLogTodbTable();
	}
	@Override
	public String schema() {
		return super.schema();
	}
	//日志类型
	public static enum LOG_TYPE{
		SYSLOG("02","系统管理日志"),
		SAFELOG("03","安全日志"),
		RUNLOG("04","运维日志"),
		BUSILOG("01","业务日志");
		private String code;
		private String name;
		private LOG_TYPE(String code, String name) {
			this.code = code;
			this.name = name;
		}
		public String getCode() {
			return code;
		}
		public String getName() {
			return name;
		}
	}
	@WsdColumn(isId=true)
	private String id;
	//操作用户类型 例如：审计员、安全员、管理员、业务员、系统@see AuthUserType
	private String userType;
	//用户id
	private String userId;
	//用户名称
	private String userName;
	//日志类型
	@WsdColumn(name="LOG_TYPE")
	private String logType;
	//日志产生ip
	private String requestIp;
	//模块。 
	private String module;
	//操作。 
	private String action;
	//操作结果。 
	private String result;
	@WsdColumn(name="log_level")
	private String level;
	//日志产生类路径，代码行
	private String line;
	//日志描述
	private String msg;
	//日志时间
	@WsdColumn(name="log_time")
	private Date logTime; 
	//异常堆栈详细信息
	private String throwMsg;
	
	@WsdNotDbColumn
	private Date beginDate;
	@WsdNotDbColumn
	private Date endDate;
	public String getUserType() {
		return userType;
	}
	public void setUserType(String userType) {
		this.userType = userType;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getRequestIp() {
		return requestIp;
	}
	public void setRequestIp(String requestIp) {
		this.requestIp = requestIp;
	}
	public String getModule() {
		return module;
	}
	public void setModule(String module) {
		this.module = module;
	}
	public String getAction() {
		return action;
	}
	public void setAction(String action) {
		this.action = action;
	}
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public String getLevel() {
		return level;
	}
	public void setLevel(String level) {
		this.level = level;
	}
	public String getLine() {
		return line;
	}
	public void setLine(String line) {
		this.line = line;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Date getLogTime() {
		return logTime;
	}
	public void setLogTime(Date logTime) {
		this.logTime = logTime;
	}
	public String getThrowMsg() {
		return throwMsg;
	}
	public void setThrowMsg(String throwMsg) {
		this.throwMsg = throwMsg;
	}
	public Date getBeginDate() {
		return beginDate;
	}
	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	
	public String getLogType() {
		return logType;
	}
	public void setLogType(String logType) {
		this.logType = logType;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@Override
	public String toString() {
		return "LogBean [id=" + id + ", userType=" + userType + ", userId="
				+ userId + ", userName=" + userName + ", logType=" + logType
				+ ", requestIp=" + requestIp + ", module=" + module
				+ ", action=" + action + ", result=" + result + ", level="
				+ level + ", line=" + line + ", msg=" + msg + ", logTime="
				+ logTime + ", throwMsg=" + throwMsg + ", beginDate="
				+ beginDate + ", endDate=" + endDate + "]";
	}
	
	
}
